package com.local.model;

import java.text.ParseException;
import java.text.SimpleDateFormat;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;

import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.NotEmpty;

@Entity
@Table(name = "work_transition")
public class WorkTransition
{
	
	private String uuid;
	@NotEmpty
	@Length(min = 1, max = 32)
	@Column(name = "work_trans_uuid")
	private String workTransUuid;
	
	@NotEmpty
	@Length(min = 1, max = 32)
	@Column(name = "arrange_work_uuid")
	private String arrangeWorkUuid;
	
	@NotEmpty
	@Length(min = 1, max = 32)
	@Column(name = "station_id")
	private String stationId;
	
	@NotEmpty
	@Length(min = 1, max = 32)
	@Column(name = "work_people_id")
	private String workPeopleId;
	
	@Column(name = "work_people_name")
	private String workPeopleName;
	
	@Column(name = "money")
	private Double money;
	
	@Column(name = "groupon_money")
	private Double grouponMoney;
	
	@Column(name = "cut_off_count")
	private Double cutOffCount;
	
	@Column(name = "move_pay_money")
	private Double movePayMoney;
	
	@Column(name = "real_price")
	private Double realPrice;
	
	@Column(name = "should_price")
	private Double shouldPrice;
	
	@Column(name = "status_")
	private Integer status;
	
	@Column(name = "remark")
	private String remark;
	
	@Column(name = "next_work_user_id")
	private String nextWorkUserId;
	
	@Column(name = "next_work_user_name")
	private String nextWorkUserName;
	
	@Column(name = "startwork_time")
	private String startworkTime;
	
	@Column(name = "endwork_time")
	private String endworkTime;
	
	@Column(name = "attr1")
	private String attr1;
	
	@Column(name = "attr2")
	private String attr2;
	
	@Column(name = "attr3")
	private String attr3;
	
	private String userId;
	
	
	private Long workTime;
	
	private Long curTime;
	
	
	public String getUserId()
	{
		return userId;
	}

	public void setUserId(String userId)
	{
		this.userId = userId;
	}

	public String getWorkTransUuid()
	{
		return workTransUuid;
	}
	
	public void setWorkTransUuid(String workTransUuid)
	{
		this.workTransUuid = workTransUuid == null ? null : workTransUuid
				.trim();
		this.uuid = workTransUuid == null ? null : workTransUuid.trim();
	}
	
	public String getArrangeWorkUuid()
	{
		return arrangeWorkUuid;
	}
	
	public void setArrangeWorkUuid(String arrangeWorkUuid)
	{
		this.arrangeWorkUuid = arrangeWorkUuid == null ? null : arrangeWorkUuid
				.trim();
	}
	
	public String getStationId()
	{
		return stationId;
	}
	
	public void setStationId(String stationId)
	{
		this.stationId = stationId == null ? null : stationId.trim();
	}
	
	public String getWorkPeopleId()
	{
		return workPeopleId;
	}
	
	public void setWorkPeopleId(String workPeopleId)
	{
		this.workPeopleId = workPeopleId == null ? null : workPeopleId.trim();
	}
	
	public String getWorkPeopleName()
	{
		return workPeopleName;
	}
	
	public void setWorkPeopleName(String workPeopleName)
	{
		this.workPeopleName = workPeopleName == null ? null : workPeopleName
				.trim();
	}
	
	public Double getMoney()
	{
		return money;
	}
	
	public void setMoney(Double money)
	{
		this.money = money;
	}
	
	public Double getGrouponMoney()
	{
		return grouponMoney;
	}
	
	public void setGrouponMoney(Double grouponMoney)
	{
		this.grouponMoney = grouponMoney;
	}
	
	public Double getCutOffCount()
	{
		return cutOffCount;
	}
	
	public void setCutOffCount(Double cutOffCount)
	{
		this.cutOffCount = cutOffCount;
	}
	
	public Double getMovePayMoney()
	{
		return movePayMoney;
	}
	
	public void setMovePayMoney(Double movePayMoney)
	{
		this.movePayMoney = movePayMoney;
	}
	
	public Double getRealPrice()
	{
		return realPrice;
	}
	
	public void setRealPrice(Double realPrice)
	{
		this.realPrice = realPrice;
	}
	
	public Double getShouldPrice()
	{
		return shouldPrice;
	}
	
	public void setShouldPrice(Double shouldPrice)
	{
		this.shouldPrice = shouldPrice;
	}
	
	public Integer getStatus()
	{
		return status;
	}
	
	public void setStatus(Integer status)
	{
		this.status = status;
	}
	
	public String getRemark()
	{
		return remark;
	}
	
	public void setRemark(String remark)
	{
		this.remark = remark == null ? null : remark.trim();
	}
	
	public String getNextWorkUserId()
	{
		return nextWorkUserId;
	}
	
	public void setNextWorkUserId(String nextWorkUserId)
	{
		this.nextWorkUserId = nextWorkUserId == null ? null : nextWorkUserId
				.trim();
	}
	
	public String getNextWorkUserName()
	{
		return nextWorkUserName;
	}
	
	public void setNextWorkUserName(String nextWorkUserName)
	{
		this.nextWorkUserName = nextWorkUserName == null ? null
				: nextWorkUserName.trim();
	}
	
	public String getStartworkTime()
	{
		return startworkTime;
	}
	
	public void setStartworkTime(String startworkTime)
	{
		this.startworkTime = startworkTime == null ? null : startworkTime
				.trim();
	}
	
	public String getEndworkTime()
	{
		return endworkTime;
	}
	
	public void setEndworkTime(String endworkTime)
	{
		this.endworkTime = endworkTime == null ? null : endworkTime.trim();
	}
	
	public String getAttr1()
	{
		return attr1;
	}
	
	public void setAttr1(String attr1)
	{
		this.attr1 = attr1 == null ? null : attr1.trim();
	}
	
	public String getAttr2()
	{
		return attr2;
	}
	
	public void setAttr2(String attr2)
	{
		this.attr2 = attr2 == null ? null : attr2.trim();
	}
	
	public String getAttr3()
	{
		return attr3;
	}
	
	public void setAttr3(String attr3)
	{
		this.attr3 = attr3 == null ? null : attr3.trim();
	}
	
	public String getUuid()
	{
		return uuid;
	}
	
	public void setUuid(String uuid)
	{
		this.uuid = uuid;
	}

	public Long getWorkTime() {
		try {
			if(this.getStartworkTime()!=null){
				return workTime = (System.currentTimeMillis()-new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(this.getStartworkTime()).getTime())/1000;
			}else{
				return 0l;
			}
		} catch (ParseException e) {
			e.printStackTrace();
			return 0l ;
		}
	}

	public Long getCurTime() {
		return System.currentTimeMillis()/1000;
	}

	
	
	
	
}